package com.neusoft.neuiotms.dcam.workflow.converter;

import org.springframework.stereotype.Component;

import com.neusoft.bizcore.web.dto.AbstractConverter;
import com.neusoft.neuiotms.dcam.workflow.dto.RukuAssetSLDTO;
import com.neusoft.neuiotms.dcam.workflow.model.RukuAssetSL;

@Component
public class RukuAssetSLConverter extends AbstractConverter<RukuAssetSL, RukuAssetSLDTO> {

    @Override
    public RukuAssetSL toModel(final RukuAssetSLDTO dto) {
        final RukuAssetSL model = new RukuAssetSL();

        model.setTypeCode(dto.getTypeCode());
        model.setTypeName(dto.getTypeName());
        model.setProductName(dto.getProductName());
        model.setSpecification(dto.getSpecification());
        model.setMoney(dto.getMoney());
        model.setLocation(dto.getLocation());
        model.setLocationName(dto.getLocationName());
        model.setMaintenanceStartTime(dto.getMaintenanceStartTime());
        model.setMaintenanceEndTime(dto.getMaintenanceEndTime());
        model.setMeasureUnit(dto.getMeasureUnit());
        model.setUsePeriod(dto.getUsePeriod());
        model.setItemId(dto.getItemId());
        model.setSerialnumber(dto.getSerialnumber());
        model.setBrand(dto.getBrand());
        return model;
    }

    @Override
    public RukuAssetSLDTO toDTO(final RukuAssetSL model, final boolean forListView) {
        final RukuAssetSLDTO dto = new RukuAssetSLDTO();

        dto.setId(model.getId());
        dto.setTypeCode(model.getTypeCode());
        dto.setTypeName(model.getTypeName());
        dto.setProductName(model.getProductName());
        dto.setSpecification(model.getSpecification());
        dto.setMoney(model.getMoney());
        dto.setLocation(model.getLocation());
        dto.setLocationName(model.getLocationName());
        dto.setMaintenanceStartTime(model.getMaintenanceStartTime());
        dto.setMaintenanceEndTime(model.getMaintenanceEndTime());
        dto.setMeasureUnit(model.getMeasureUnit());
        dto.setUsePeriod(model.getUsePeriod());
        dto.setItemId(model.getItemId());
        dto.setSerialnumber(model.getSerialnumber());
        dto.setBrand(model.getBrand());
        return dto;
    }

}
